import tensorflow as tf

def kron(a,b):
    [am,an]=a.shape.as_list()
    [bm,bn]=b.shape.as_list()
    a = tf.reshape(a,[1,am,1,an])
    b = tf.reshape(b,[bm,1,bn,1])
    K = tf.reshape(tf.multiply(a,b),[am*bm,an*bn])

    return K